﻿<UserControl x:Class="Views.ViewEncoursCorresp"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2006"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:TxGar="clr-namespace:TauxGaranti"
             xmlns:ViewModels="clr-namespace:TauxGaranti.ViewModels"
             DataContext="{Binding Source={x:Static ViewModels:Locator.ViewModeleMainWindowStatic}}"
             mc:Ignorable="d">
    
    <UserControl.Resources>

        <CollectionViewSource x:Key="CollViewVariablesEntreeEncours"
                              Source="{Binding ViewModelCmdEncoursCorresp.VariablesEntreeEncours}">
            <CollectionViewSource.GroupDescriptions>
                <PropertyGroupDescription PropertyName="Value.chOutil.Format.typeAff.Name"></PropertyGroupDescription>
            </CollectionViewSource.GroupDescriptions>
        </CollectionViewSource>
        
        <CollectionViewSource x:Key="CollViewVariablesTbleEntree"
                              Source="{Binding ViewModelCmdEncoursCorresp.VariablesEntreeBase}">
            <CollectionViewSource.GroupDescriptions>
                <!--<PropertyGroupDescription PropertyName="Value.chOutil.getFormat.formatAff"></PropertyGroupDescription>-->
                <PropertyGroupDescription PropertyName="Value.chOutil.Format.typeAff.Name"></PropertyGroupDescription>
            </CollectionViewSource.GroupDescriptions>
        </CollectionViewSource>
        
    </UserControl.Resources>
    
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*" />
            <ColumnDefinition Width="5" />
            <ColumnDefinition Width="2*" />
        </Grid.ColumnDefinitions>
        <DockPanel Grid.Column="0">
            <Label Style="{DynamicResource OMANE_labelTitre}" 
                   DockPanel.Dock="Top"
                   Margin="-1,-1,0,0">Champs du fichier source</Label>
            <ListView ItemsSource="{Binding Source={StaticResource CollViewVariablesTbleEntree}}" 
                      BorderThickness="0,0,1,0">
                <ListView.GroupStyle>
                    <GroupStyle>
                        <GroupStyle.ContainerStyle>
                            <Style TargetType="{x:Type GroupItem}">
                                <Setter Property="Margin" Value="0,0,0,5"></Setter>
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="{x:Type GroupItem}">
                                            <Expander IsExpanded="True" BorderBrush="#FFA4B97F" BorderThickness="0,0,0,1">
                                                <Expander.Header>
                                                    <DockPanel>
                                                        <TextBlock FontWeight="Bold" Text="{Binding Path=Name, Converter={StaticResource TypeNameConverter}}"
                                                                   Margin="5,0,0,0" Width="100" />
                                                        <TextBlock FontWeight="Bold" Text="{Binding Path=ItemCount}" />
                                                    </DockPanel>
                                                </Expander.Header>
                                                <Expander.Content>
                                                    <ItemsPresenter />
                                                </Expander.Content>
                                            </Expander>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </GroupStyle.ContainerStyle>
                    </GroupStyle>
                </ListView.GroupStyle>
                <ListView.View>
                    <GridView>
                        <GridView.ColumnHeaderContainerStyle>
                            <Style>
                                <Setter Property="FrameworkElement.Visibility" Value="Collapsed" />
                            </Style>
                        </GridView.ColumnHeaderContainerStyle>
                        <GridView.Columns>
                            <GridViewColumn Header="D">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal">
                                            <!--<Image Source="{Binding Value.chOutil.Format.typeAff.Name, Converter={StaticResource TypeNameToIconConverter}}"></Image>-->
                                            <Image Margin="0,0,5,0" Source="{Binding Value.chOutil.Format.typeAff.Name , Converter={StaticResource TypeNameToIconConverter}}"></Image>
                                            <TextBlock FontWeight="Regular" Text="{Binding Key}"></TextBlock>
                                        </StackPanel>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                        </GridView.Columns>
                    </GridView>
                </ListView.View>
            </ListView>
        </DockPanel>
        <GridSplitter Background="White" 
                      HorizontalAlignment="Stretch" 
                      Grid.Column="1"
                      BorderBrush="{StaticResource ResourceKey=BrushCouleur1Base}"/>
        <DockPanel Grid.Column="2">
            <Label Style="{DynamicResource OMANE_labelTitre}" 
                   DockPanel.Dock="Top"
                   Margin="-1,-1,0,0">Modèle d'intégration de la table d'encours</Label>
            
            <!--<ListView BorderThickness="0,0,1,0"
                      ItemsSource="{Binding ViewModelCmdEncoursCorresp.VariablesEntreeEncours}">
                <ListView.View>
                    <GridView>
                        <GridView.ColumnHeaderContainerStyle>
                            <Style>
                                <Setter Property="FrameworkElement.Visibility" Value="Collapsed" />
                            </Style>
                        </GridView.ColumnHeaderContainerStyle>
                        <GridView.Columns>
                            <GridViewColumn>
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal">
                                            <Button Margin="0,0,2,0" Width="20" Height="20" Background="{StaticResource ResourceKey=BrushBtnCorrespEtat}" 
                                                    BorderBrush="{StaticResource ResourceKey=BrushBtnCorrespEtat}" Style="{StaticResource btnCorresp}" />
                                            <Button Margin="0,0,2,0" Width="20" Height="20" Background="{StaticResource ResourceKey=BrushBtnCorrespDesc}"
                                                    BorderBrush="{StaticResource ResourceKey=BrushBtnCorrespDesc}" Style="{StaticResource btnCorresp}" />
                                            <Button Width="20" Height="20" Background="{StaticResource ResourceKey=BrushBtnCorrespSuppr}"
                                                    BorderBrush="{StaticResource ResourceKey=BrushBtnCorrespSuppr}" Style="{StaticResource btnCorresp}" />
                                        </StackPanel>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn Width="Auto">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Key}"></TextBlock>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn>
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Value.chOutil.Format.typeAff.Name}"></TextBlock>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                        </GridView.Columns>
                    </GridView>
                </ListView.View>
            </ListView>-->

            <ListView ItemsSource="{Binding Source={StaticResource CollViewVariablesEntreeEncours}}" 
                      BorderThickness="0,0,1,0" 
                      FontWeight="Regular">
                <ListView.GroupStyle>
                    <GroupStyle>
                        <GroupStyle.ContainerStyle>
                            <Style TargetType="{x:Type GroupItem}">
                                <Setter Property="Margin" Value="0,0,0,5"></Setter>
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="{x:Type GroupItem}">
                                            <Expander IsExpanded="True" BorderBrush="#FFA4B97F" BorderThickness="0,0,0,1">
                                                <Expander.Header>
                                                    <DockPanel>
                                                        <TextBlock FontWeight="Bold" Text="{Binding Path=Name}"
                                                                   Margin="5,0,0,0" Width="100" />
                                                        <TextBlock FontWeight="Bold" Text="{Binding Path=ItemCount}" />
                                                    </DockPanel>
                                                </Expander.Header>
                                                <Expander.Content>
                                                    <ItemsPresenter />
                                                </Expander.Content>
                                            </Expander>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </GroupStyle.ContainerStyle>
                    </GroupStyle>
                </ListView.GroupStyle>
                <ListView.View>
                    <GridView>
                        <GridView.ColumnHeaderContainerStyle>
                            <Style>
                                <Setter Property="FrameworkElement.Visibility" Value="Collapsed" />
                            </Style>
                        </GridView.ColumnHeaderContainerStyle>
                        <GridView.Columns>
                            <GridViewColumn>
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal">
                                            <Button Margin="0,0,2,0" Width="20" Height="20" Background="{StaticResource ResourceKey=BrushBtnCorrespEtat}" 
                                                    BorderBrush="{StaticResource ResourceKey=BrushBtnCorrespEtat}" Style="{StaticResource btnCorresp}" />
                                            <Button Margin="0,0,2,0" Width="20" Height="20" Background="{StaticResource ResourceKey=BrushBtnCorrespDesc}"
                                                    BorderBrush="{StaticResource ResourceKey=BrushBtnCorrespDesc}" Style="{StaticResource btnCorresp}" />
                                            <Button Width="20" Height="20" Background="{StaticResource ResourceKey=BrushBtnCorrespSuppr}"
                                                    BorderBrush="{StaticResource ResourceKey=BrushBtnCorrespSuppr}" Style="{StaticResource btnCorresp}" />
                                        </StackPanel>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn>
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Key}"></TextBlock>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn>
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Value.chOutil.Format.typeAff.Name}"></TextBlock>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                        </GridView.Columns>
                    </GridView>
                </ListView.View>
            </ListView>
            
            
            <!--<Label Style="{DynamicResource OMANE_labelTitre}" 
                   DockPanel.Dock="Top"
                   Margin="-1,-1,0,0">Liste des champs à intégrer dans OMANE</Label>-->
        </DockPanel>


        <!--<ListView Grid.Column="3" ItemsSource="{Binding ViewModelCmdEncoursCorresp.VariablesEntreeEncours}">
            <ListView.View>
                <GridView>                    
                    <GridView.Columns>
                        <GridViewColumn Header="test" Width="300">
                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock FontWeight="Regular" Text="{Binding Key}"></TextBlock>
                                        <TextBlock Margin="20,0,0,0" FontWeight="Regular" Text="{Binding Value.chOutil.Format.typeAff.Name}"></TextBlock>
                                    </StackPanel>
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>
                        </GridViewColumn>
                    </GridView.Columns>
                </GridView>
            </ListView.View>
        </ListView>--> 
    </Grid>
</UserControl>
